<template>
  <Card v-bind="$attrs">
    <Alert message="以下这些信息为自定义个性信息，填写之后将在系统中完全公开。" banner />
    <br />
    <BasicForm @register="registerForm" @submit="handleSubmit" />
  </Card>
</template>
<script lang="ts" setup>
  import { onMounted } from "vue";
  import { Alert, Card } from "ant-design-vue";
  import { formSchemas } from "./profile.data";
  import { useMessage } from "/@/hooks/web/useMessage";
  import { useUserStore } from "/@/store/modules/user";
  import { BasicForm, useForm } from "/@/components/Form/index";
  import { defaultFormSettings } from "/@/hooks/core/useDefault";

  const [registerForm, { setFieldsValue }] = useForm({
    labelCol: { span: 3 },
    schemas: formSchemas,
    ...defaultFormSettings,
  });

  const { createMessage } = useMessage();

  function handleSubmit(value) {
    console.log(value);
    createMessage.error("功能暂未实现！");
  }

  const userStore = useUserStore();

  onMounted(async () => {
    await setFieldsValue(userStore.getUserInfo);
  });
</script>
